import com.pojo.User;
import org.junit.Test;

import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

public class UserTest {
    @Test
    public void userFindByIdTest(){
        String resources = "mybatis-config.xml";
        Reader reader = null;
        try{
            reader = Resources.getResourceAsReader(resources);
        } catch (IOException e) {
            e.printStackTrace();
        }
        SqlSessionFactory sqlMapper=new
                SqlSessionFctoryBuilder().build(reader);
        SqlSession session=sqlMapper.openSession();
        User user=session.selectOne("findByID",1);
        System.out.println(user.getUname());
        session.close();
    }
}
